package logic

import (
	"context"
	"rent-ease/mysql"

	"rent-ease/zurpc/internal/svc"
	"rent-ease/zurpc/zurpc"

	"github.com/zeromicro/go-zero/core/logx"
)

type ZuShowLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewZuShowLogic(ctx context.Context, svcCtx *svc.ServiceContext) *ZuShowLogic {
	return &ZuShowLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *ZuShowLogic) ZuShow(in *zurpc.ZuShowRequest) (*zurpc.ZuShowResponse, error) {
	// todo: add your logic here and delete this line
	var user mysql.Fang
	if err := user.ZuShow(mysql.DB, in.FangId); err != nil {
		return nil, err
	}
	return &zurpc.ZuShowResponse{
		Name:    user.Name,
		Address: user.Address,
		Price:   float32(user.Price),
	}, nil
}
